#pragma once

namespace krryn{
namespace core{
	template<typename _Ty, typename _Ptr = _Ty*>
	class ctor_t{
	public:
		_Ptr operator()(){
			return new _Ty();
		}
	};

	template<typename _Ty, typename _Arg, typename _Ptr = _Ty*>
	class ctor1_t{
	public:
		ctor1_t(const _Arg &a_Arg) : m_Arg(a_Arg) {}

		_Ptr operator()(){
			return new _Ty(m_Arg);
		}
	private:
		_Arg m_Arg;
	};

	template<typename _Ty>
	class ref_t{
	public:
		ref_t(_Ty &a_Ref) : m_Ref(a_Ref) {}

		operator _Ty&() const{
			return m_Ref;
		}
	private:
		_Ty &m_Ref;
	};
	
	template<typename _Ty>
	ctor_t<_Ty> ctor(){
		return ctor_t<_Ty>();
	}

	template<typename _Ty, typename _Arg>
	ctor1_t<_Ty, _Arg> ctor1(const _Arg &a_Arg){
		return ctor1_t<_Ty, _Arg>(a_Arg);
	}

	template<typename _Ty>
	inline ref_t<_Ty> ref(_Ty &a_Ref){
		return ref_t<_Ty>(a_Ref);
	}
}
}